Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
Loading...
Searching...
No Matches
ibackend.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2019 Roc authors
3 *
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 */
8
9//! @file roc_sndio/ibackend.h
10//! @brief Backend interface.
11
12#ifndef ROC_SNDIO_IBACKEND_H_
13#define ROC_SNDIO_IBACKEND_H_
14
15#include "roc_core/array.h"
16#include "roc_core/iallocator.h"
17#include "roc_core/shared_ptr.h"
18#include "roc_sndio/config.h"
20#include "roc_sndio/isink.h"
21#include "roc_sndio/isource.h"
22
23namespace roc {
24namespace sndio {
25
26//! Backend interface.
27class IBackend {
28public:
29 virtual ~IBackend();
30
31 //! Probing flags.
33 //! Input or output may be a sink.
34 FilterSink = (1 << 0),
35
36 //! Input or output may be a source.
37 FilterSource = (1 << 1),
38
39 //! Input or output may be a file.
40 FilterFile = (1 << 2),
41
42 //! Input or output may be a device.
43 FilterDevice = (1 << 3)
44 };
45
46 //! Check whether the backend can handle given input or output.
47 virtual bool probe(const char* driver, const char* inout, int filter_flags) = 0;
48
49 //! Create and open a sink.
50 virtual ISink* open_sink(core::IAllocator& allocator,
51 const char* driver,
52 const char* output,
53 const Config& config) = 0;
54
55 //! Create and open a source.
57 const char* driver,
58 const char* input,
59 const Config& config) = 0;
60
61 //! Append supported dirvers to the list.
62 virtual bool get_drivers(core::Array<DriverInfo>& arr, int filter_flags) = 0;
63};
64
65} // namespace sndio
66} // namespace roc
67
68#endif // ROC_SNDIO_IBACKEND_H_
Dynamic array.
Dynamic array.
Definition: array.h:25
Memory allocator interface.
Definition: iallocator.h:23
Backend interface.
Definition: ibackend.h:27
virtual bool probe(const char *driver, const char *inout, int filter_flags)=0
Check whether the backend can handle given input or output.
virtual bool get_drivers(core::Array< DriverInfo > &arr, int filter_flags)=0
Append supported dirvers to the list.
virtual ISink * open_sink(core::IAllocator &allocator, const char *driver, const char *output, const Config &config)=0
Create and open a sink.
FilterFlags
Probing flags.
Definition: ibackend.h:32
@ FilterFile
Input or output may be a file.
Definition: ibackend.h:40
@ FilterSink
Input or output may be a sink.
Definition: ibackend.h:34
@ FilterDevice
Input or output may be a device.
Definition: ibackend.h:43
@ FilterSource
Input or output may be a source.
Definition: ibackend.h:37
virtual ISource * open_source(core::IAllocator &allocator, const char *driver, const char *input, const Config &config)=0
Create and open a source.
Sink interface.
Definition: isink.h:21
Source interface.
Definition: isource.h:21
Driver info interface.
Memory allocator interface.
Sink interface.
Source interface.
Root namespace.
Sink and source config.
Shared ownership intrusive pointer.
Sink and source config.
Definition: config.h:22